class Solution {
public:
    bool isPalindrome(int x) {
        if (x < 0)
        {
            return false;
        }
        size_t cur = 0;
        int  num = x;
        while(num != 0)
        {
            cur = cur * 10 + num % 10;
            num = (int)(num / 10); 
        }
        if (cur == x)
        {
            return true;
        } 
        else
        {
            return false;
        }

    }
};

class Solution {
public:
    bool isPalindrome(int x) {
        if (x < 0)
        {
            return false;
        }
        std::string input = to_string(x);
        int num = input.size();
        std::string front = input.substr(0, (int)(num/2));
        std::string back;
        num % 2 == 0 ? back = input.substr((int)(num/2), num): back = input.substr((int)(num/2) + 1, num);
        reverse(back.begin(), back.end());
        if(front == back)
        {
            return true;
        }
        else
        {
            return false;
        }
        // front == back ? return true : return false;
    }
};